﻿using RiderShop.Mobile.Common.ThirdEntity;
using Senparc.Weixin.Helpers;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RiderShop.Mobile.Modle
{
    public class WeixinJsSdkModel
    {
        public WeixinJsSdkModel(string siteUrl)
        {
            AppId = ConfigurationManager.AppSettings["WeixingAuthAppId"];
            Timestamp = DateTimeHelper.GetWeixinDateTime(DateTime.Now).ToString();
            NonceStr = System.IO.Path.GetRandomFileName().Replace(".", "");
            SiteUrl = siteUrl;
            Signature = Utility.GetJsAPI_Signature(Utility.GetJsAPI_Token(), NonceStr, Timestamp, SiteUrl);
        }



        /// <summary>
        ///  必填，公众号的唯一标识
        /// </summary>
        public string AppId { get; set; }

        /// <summary>
        ///  必填，生成签名的时间戳
        /// </summary>
        public string Timestamp { get; set; }

        /// <summary>
        /// 必填，生成签名的随机串
        /// </summary>
        public string NonceStr { get; set; }

        /// <summary>
        ///  必填，签名
        /// </summary>
        public string Signature { get; set; }

        /// <summary>
        /// 当前网页的URL，不包含#及其后面部分
        /// </summary>
        public string SiteUrl { get; set; }
    }
}
